package pwd.allen.util.jackson;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import javax.json.bind.annotation.JsonbNumberFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author 门那粒沙
 * @create 2020-10-31 20:30
 **/
@Data
//@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public class MyJacksonJson {
    /**
     * 如果是Long，前端获取的数据可能会超过Integer的最大值，所以需要使用ToStringSerializer将Long转成String
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long l;
    private String str;
    private Integer i;
    private Float f;
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd", shape = JsonFormat.Shape.STRING)
    private Date ymd;
    private Date date;
//    @JsonSerialize(using = CustomBigDecimalSerializer.class)
    private BigDecimal bigDecimal;
    @JsonIgnore
    private String ignore;
    @JsonInclude(JsonInclude.Include.ALWAYS)
    private String strNull = null;
    private String strEmpty = "";
//    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<String> emtryList = new ArrayList<String>();

    private StatusEnum statusEnum;
}
